package com.io.file;

import java.io.File;
import java.io.FilenameFilter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/*
 *  a class called anonymity
 */
public class file2Anonymity {
	public static FilenameFilter filter( final String file) {
		return new FilenameFilter() {
			String files = file;

			@Override
			public boolean accept(File dir, String name) {
				String f = new File(name).getName();
				return f.indexOf(files) != -1;
			}
		};
	}

	public static void main(String[] args) {
		File file = new File(".");
		String[] list;
		if (args.length == 0) {
			list = file.list();
		} else {
			list = file.list(filter(args[0]));
		}
		List alist=new ArrayList();
		for (int i = 0; i < list.length; i++) {
			alist.add(list[i]);
		}
		Collections.sort(alist);
		for(int i=0;i<alist.size();i++){
			System.out.println(list[i]);
		}
	}

}
